package com.shrct.businessprocess;

import com.google.common.base.Objects;
import com.shrct.businessprocess.budget.RCCostBreakDown;
import com.shrct.businessprocess.common.RCSystemConfiguration;
import com.shrct.businessprocess.common.impl.RCSystemConfigurationImpl;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.organization.RCEmployeeDAO;
import com.shrct.businessprocess.organization.RCEnterprise;
import com.shrct.businessprocess.organization.RCOrganizationService;
import com.shrct.businessprocess.product.RCNormalizerService;
import com.shrct.businessprocess.product.RCProductServiceTracer;
import com.shrct.businessprocess.project.RCInitializeProjectProcess;
import com.shrct.businessprocess.project.RCParameterService;
import com.shrct.businessprocess.project.RCParameters;
import com.shrct.businessprocess.project.RCProject;
import com.shrct.businessprocess.project.RCProjectProcessEvent;
import com.shrct.businessprocess.project.RCProjectStat;
import com.shrct.businessprocess.project.RCProjectStatus;
import com.shrct.businessprocess.project.impl.RCProjectStatImpl;
import com.shrct.businessprocess.purchase.RCBudgetContract;
import com.shrct.businessprocess.purchase.RCBudgetContractItem;
import com.shrct.businessprocess.purchase.RCFullServicePurchaseBudget;
import com.shrct.businessprocess.purchase.RCHasPurchaseBudget;
import edu.fudan.langlab.domain.organization.RoleManager;
import edu.fudan.langlab.domain.security.AppFunction;
import edu.fudan.langlab.domain.security.impl.AppFunctionImpl;
import edu.fudan.langlab.domain.updater.IUpgrader;
import edu.fudan.langlab.domain.updater.UpdateServie;
import edu.fudan.mylang.pf.BaseService;
import edu.fudan.mylang.pf.IGenericQuery;
import java.util.Collection;
import java.util.Date;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("V_0_1")
public class V_0_1 extends BaseService implements IUpgrader {
  @Autowired
  private RCOrganizationService organizationService;
  
  @Autowired
  private RCNormalizerService normalizer;
  
  @Autowired
  private RCEmployeeDAO employeeDAO;
  
  @Autowired
  private RoleManager roleManager;
  
  @Autowired
  private RCParameterService parameterService;
  
  public void setupSystemConfiguration() {RCSystemConfiguration rCSystemConfiguration=RCSystemConfigurationImpl.create(getObjectFactory());
    final Procedure1<RCSystemConfiguration> _function = new Procedure1<RCSystemConfiguration>() {
        public void apply(final RCSystemConfiguration it) {
          it.setUsdollarExchangeRate(Double.valueOf(6.3));
        }
      };
    ObjectExtensions.<RCSystemConfiguration>operator_doubleArrow(rCSystemConfiguration, _function);
  }
  
  public void setupHostEnterprise() {
    RCEnterprise _registerEnterprise = this.organizationService.registerEnterprise("0000001");
    final Procedure1<RCEnterprise> _function = new Procedure1<RCEnterprise>() {
        public void apply(final RCEnterprise it) {
          it.setName("\u4E91\u591A\u79D1\u6280");
          it.setIsBuildin(Boolean.valueOf(true));
        }
      };
    ObjectExtensions.<RCEnterprise>operator_doubleArrow(_registerEnterprise, _function);
  }
  
  public void projectStatus() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select p from com.shrct.businessprocess.project.impl.RCProjectImpl as p   where  p.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          RCProjectStatus _status = it.getStatus();
          boolean _equals = Objects.equal(_status, null);
          if (_equals) {
            it.setStatus(RCProjectStatus.creating);
          }
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void initUsers() {
    RCEmployee _registerEmployee = this.organizationService.registerEmployee("lzhang");
    final Procedure1<RCEmployee> _function = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5F20\u4E3D");
          it.setEmail("lzhang@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee, _function);
    RCEmployee _registerEmployee_1 = this.organizationService.registerEmployee("ttliu");
    final Procedure1<RCEmployee> _function_1 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5218\u5A77\u5A77");
          it.setEmail("ttliu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_1, _function_1);
    RCEmployee _registerEmployee_2 = this.organizationService.registerEmployee("syliu");
    final Procedure1<RCEmployee> _function_2 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5218\u8BD7\u541F");
          it.setEmail("syliu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_2, _function_2);
    RCEmployee _registerEmployee_3 = this.organizationService.registerEmployee("lli");
    final Procedure1<RCEmployee> _function_3 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u674E\u8389");
          it.setEmail("lli@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_3, _function_3);
    RCEmployee _registerEmployee_4 = this.organizationService.registerEmployee("ypqu");
    final Procedure1<RCEmployee> _function_4 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u77BF\u4EA6\u5E73");
          it.setEmail("ypqu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_4, _function_4);
    RCEmployee _registerEmployee_5 = this.organizationService.registerEmployee("dwu");
    final Procedure1<RCEmployee> _function_5 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5434\u8FEA");
          it.setEmail("dwu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_5, _function_5);
    RCEmployee _registerEmployee_6 = this.organizationService.registerEmployee("bjjin");
    final Procedure1<RCEmployee> _function_6 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u91D1\u500D\u519B");
          it.setEmail("bjjin@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_6, _function_6);
    RCEmployee _registerEmployee_7 = this.organizationService.registerEmployee("lhuang");
    final Procedure1<RCEmployee> _function_7 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u9EC4\u857E");
          it.setEmail("lhuang@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_7, _function_7);
    RCEmployee _registerEmployee_8 = this.organizationService.registerEmployee("yyang");
    final Procedure1<RCEmployee> _function_8 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u6768\u9896");
          it.setEmail("yyang@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_8, _function_8);
    RCEmployee _registerEmployee_9 = this.organizationService.registerEmployee("yjxia");
    final Procedure1<RCEmployee> _function_9 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u590F\u56ED\u83C1");
          it.setEmail("yjxia@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_9, _function_9);
    RCEmployee _registerEmployee_10 = this.organizationService.registerEmployee("danwu");
    final Procedure1<RCEmployee> _function_10 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5434\u4E39");
          it.setEmail("danwu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_10, _function_10);
    RCEmployee _registerEmployee_11 = this.organizationService.registerEmployee("glin");
    final Procedure1<RCEmployee> _function_11 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u6797\u6B4C");
          it.setEmail("glin@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_11, _function_11);
    RCEmployee _registerEmployee_12 = this.organizationService.registerEmployee("dqxia");
    final Procedure1<RCEmployee> _function_12 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u590F\u4E1C\u7426");
          it.setEmail("dqxia@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_12, _function_12);
    RCEmployee _registerEmployee_13 = this.organizationService.registerEmployee("aqmin");
    final Procedure1<RCEmployee> _function_13 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u95F5\u5B89\u742A");
          it.setEmail("aqmin@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_13, _function_13);
    RCEmployee _registerEmployee_14 = this.organizationService.registerEmployee("zlyan");
    final Procedure1<RCEmployee> _function_14 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u4E25\u81EA\u529B");
          it.setEmail("zlyan@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_14, _function_14);
    RCEmployee _registerEmployee_15 = this.organizationService.registerEmployee("zhwang");
    final Procedure1<RCEmployee> _function_15 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u738B\u5FD7\u8F89");
          it.setEmail("zhwang@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_15, _function_15);
    RCEmployee _registerEmployee_16 = this.organizationService.registerEmployee("ztm");
    final Procedure1<RCEmployee> _function_16 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u6731\u5929\u6885");
          it.setEmail("ztm@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_16, _function_16);
    RCEmployee _registerEmployee_17 = this.organizationService.registerEmployee("lxf");
    final Procedure1<RCEmployee> _function_17 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5218\u6653\u98CE");
          it.setEmail("lxf@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_17, _function_17);
    RCEmployee _registerEmployee_18 = this.organizationService.registerEmployee("ldx");
    final Procedure1<RCEmployee> _function_18 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u674E\u4E1C\u6653");
          it.setEmail("ldx@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_18, _function_18);
    RCEmployee _registerEmployee_19 = this.organizationService.registerEmployee("xd");
    final Procedure1<RCEmployee> _function_19 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5F90\u4E1C");
          it.setEmail("xd@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_19, _function_19);
    RCEmployee _registerEmployee_20 = this.organizationService.registerEmployee("xl");
    final Procedure1<RCEmployee> _function_20 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5F90\u78CA");
          it.setEmail("xl@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_20, _function_20);
    RCEmployee _registerEmployee_21 = this.organizationService.registerEmployee("lj");
    final Procedure1<RCEmployee> _function_21 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u674E\u4FCA");
          it.setEmail("lj@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_21, _function_21);
    RCEmployee _registerEmployee_22 = this.organizationService.registerEmployee("yb");
    final Procedure1<RCEmployee> _function_22 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u6768\u6EE8");
          it.setEmail("yb@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_22, _function_22);
    RCEmployee _registerEmployee_23 = this.organizationService.registerEmployee("yty");
    final Procedure1<RCEmployee> _function_23 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u8425\u5929\u9065");
          it.setEmail("yty@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_23, _function_23);
    RCEmployee _registerEmployee_24 = this.organizationService.registerEmployee("xwshi");
    final Procedure1<RCEmployee> _function_24 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u65F6\u6653\u6587");
          it.setEmail("xwshi@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_24, _function_24);
    RCEmployee _registerEmployee_25 = this.organizationService.registerEmployee("jlfu");
    final Procedure1<RCEmployee> _function_25 = new Procedure1<RCEmployee>() {
        public void apply(final RCEmployee it) {
          it.setName("\u5085\u4F73\u7490");
          it.setEmail("jlfu@shrct.com");
        }
      };
    ObjectExtensions.<RCEmployee>operator_doubleArrow(_registerEmployee_25, _function_25);
  }
  
  public void isIncludeInContractInit() {IGenericQuery<RCBudgetContractItem> query=getObjectFactory().createGenericQuery(RCBudgetContractItem.class,"select e from com.shrct.businessprocess.purchase.impl.RCBudgetContractItemImpl as e   where  e.active = 1      ");
    Collection<RCBudgetContractItem> _list = query.list();
    final Procedure1<RCBudgetContractItem> _function = new Procedure1<RCBudgetContractItem>() {
        public void apply(final RCBudgetContractItem it) {
          it.setIsIncludeInContract(Boolean.valueOf(true));
        }
      };
    IterableExtensions.<RCBudgetContractItem>forEach(_list, _function);
  }
  
  public void initFunctions1222() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagement");
          it.setFunctionId("com.shrct.businessprocess.web.ExportProjectCommand");
          it.setName("\u9879\u76EE\u4FE1\u606F\u5BFC\u51FA");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);AppFunction appFunction_1=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_1 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.BudgetManagement4ProductPurchasePresenter.transferCostRequest");
          it.setName("\u644A\u9500");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_1, _function_1);AppFunction appFunction_2=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_2 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.productServiceManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.UpdateIdentifiablePhysicalProductEntryCommand");
          it.setName("\u4FEE\u6539");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_2, _function_2);AppFunction appFunction_3=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_3 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.productServiceManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.UpdateFullServiceProductEntryCommand");
          it.setName("\u4FEE\u6539\u4F9B\u5E94\u5546\u670D\u52A1");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_3, _function_3);AppFunction appFunction_4=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_4 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.productServiceManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.UpdateCompanyServiceCommand");
          it.setName("\u4FEE\u6539\u627F\u8BFA\u670D\u52A1");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_4, _function_4);AppFunction appFunction_5=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_5 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.faultReportManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.customerservice.web.EngineerReportCommand");
          it.setName("\u8BB0\u5F55\u7EF4\u4FEE\u65E5\u5FD7");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_5, _function_5);
  }
  
  public void initFunctions121() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagement");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.ProjectWorkbenchPresenter.showProjectCustomerContractRequest");
          it.setName("\u9500\u552E\u5408\u540C\u7EF4\u62A4");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);AppFunction appFunction_1=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_1 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagement");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.ProjectWorkbenchPresenter.modifyCBDStatusRequest");
          it.setName("CBD\u72B6\u6001\u8BBE\u7F6E");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_1, _function_1);AppFunction appFunction_2=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_2 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.createRequest");
          it.setName("\u65B0\u5EFA\u9879\u76EE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_2, _function_2);AppFunction appFunction_3=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_3 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.deleteRequest");
          it.setName("\u5220\u9664\u9879\u76EE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_3, _function_3);AppFunction appFunction_4=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_4 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.modifyRequest");
          it.setName("\u4FEE\u6539\u9879\u76EE\u4FE1\u606F");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_4, _function_4);AppFunction appFunction_5=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_5 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.commit4audit");
          it.setName("\u63D0\u4EA4\u7533\u8BF7");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_5, _function_5);AppFunction appFunction_6=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_6 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.showAuditActivities");
          it.setName("\u663E\u793A\u7533\u8BF7\u6D41\u7A0B");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_6, _function_6);AppFunction appFunction_7=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_7 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.editCBDRequest");
          it.setName("\u4FEE\u6539CBD");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_7, _function_7);AppFunction appFunction_8=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_8 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.showProjectWorkbenchRequest");
          it.setName("\u6253\u5F00\u9879\u76EE");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_8, _function_8);AppFunction appFunction_9=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_9 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.showDiagnoseInfo");
          it.setName("\u67E5\u770B\u63D0\u793A\u4FE1\u606F");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_9, _function_9);AppFunction appFunction_10=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_10 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.showActualCost");
          it.setName("\u67E5\u770BActual Cost");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_10, _function_10);AppFunction appFunction_11=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function_11 = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.myProjectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.MyProjectManagementPresenter.signContractRequest");
          it.setName("\u9879\u76EE\u5DF2\u7B7E\u7EA6");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction_11, _function_11);
  }
  
  public void orderId() {
    RCParameters _paremeters = this.parameterService.getParemeters();
    _paremeters.setOrderId(Integer.valueOf(28));
  }
  
  public void serviceBudgetContract() {IGenericQuery<RCProductServiceTracer> query=getObjectFactory().createGenericQuery(RCProductServiceTracer.class,"select e from com.shrct.businessprocess.product.impl.RCProductServiceTracerImpl as e   where  e.active = 1      ");
    Collection<RCProductServiceTracer> _list = query.list();
    final Function1<RCProductServiceTracer,Boolean> _function = new Function1<RCProductServiceTracer,Boolean>() {
        public Boolean apply(final RCProductServiceTracer it) {
          RCHasPurchaseBudget _budget = it.getBudget();
          return Boolean.valueOf((_budget instanceof RCFullServicePurchaseBudget));
        }
      };
    Iterable<RCProductServiceTracer> _filter = IterableExtensions.<RCProductServiceTracer>filter(_list, _function);
    final Procedure1<RCProductServiceTracer> _function_1 = new Procedure1<RCProductServiceTracer>() {
        public void apply(final RCProductServiceTracer it) {
          RCHasPurchaseBudget _budget = it.getBudget();
          Collection<RCBudgetContract> _contracts = _budget.getContracts();
          int _size = _contracts.size();
          boolean _greaterThan = (_size > 1);
          if (_greaterThan) {
            RCHasPurchaseBudget _budget_1 = it.getBudget();
            RCCostBreakDown _cbd = _budget_1.getCbd();
            RCProject _project = _cbd.getProject();
            String _code = _project.getCode();
            String _plus = ("\u975E\u6CD5\u6570\u636E" + _code);
            RuntimeException _runtimeException = new RuntimeException(_plus);
            throw _runtimeException;
          }
          RCHasPurchaseBudget _budget_2 = it.getBudget();
          Collection<RCBudgetContract> _contracts_1 = _budget_2.getContracts();
          RCBudgetContract _head = IterableExtensions.<RCBudgetContract>head(_contracts_1);
          it.setBudgetContract(_head);
        }
      };
    IterableExtensions.<RCProductServiceTracer>forEach(_filter, _function_1);
  }
  
  public void projectSimplePy() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          it.setSimplePy("");
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void projectPassDate() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {
          RCInitializeProjectProcess _initializeProcess = it.getInitializeProcess();
          RCProjectProcessEvent _event = _initializeProcess==null?(RCProjectProcessEvent)null:_initializeProcess.getEvent();
          Date _finishDate = _event==null?(Date)null:_event.getFinishDate();
          it.setPassDate(_finishDate);
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  public void modifyCDBTitleFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.ProjectManagementPresenter.editCBDRequest");
          it.setName("\u4FEE\u6539CBD");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void fixACTFunction() {AppFunction appFunction=AppFunctionImpl.create(getObjectFactory());
    final Procedure1<AppFunction> _function = new Procedure1<AppFunction>() {
        public void apply(final AppFunction it) {
          it.setParentFunctionId("com.shrct.businessprocess.web.projectManagementPresenter");
          it.setFunctionId("com.shrct.businessprocess.web.client.project.ProjectManagementPresenter.fixActualCost");
          it.setName("\u6C47\u603BACT");
        }
      };
    ObjectExtensions.<AppFunction>operator_doubleArrow(appFunction, _function);
  }
  
  public void updateProjectContractPriceStat() {IGenericQuery<RCProject> query=getObjectFactory().createGenericQuery(RCProject.class,"select e from com.shrct.businessprocess.project.impl.RCProjectImpl as e   where  e.active = 1      ");
    Collection<RCProject> _list = query.list();
    final Procedure1<RCProject> _function = new Procedure1<RCProject>() {
        public void apply(final RCProject it) {RCProjectStat rCProjectStat=RCProjectStatImpl.create(getObjectFactory());
          it.setStat(rCProjectStat);
          RCProjectStat _stat = it.getStat();
          _stat.updateContractPrice();
        }
      };
    IterableExtensions.<RCProject>forEach(_list, _function);
  }
  
  @Autowired
  private UpdateServie updateService;
  
  public void doUpgrade() {
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "setupSystemConfiguration")) {
    	setupSystemConfiguration();
    	updateService.updaterCommited("V_0_1", "V_0_1", "setupSystemConfiguration");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "setupHostEnterprise")) {
    	setupHostEnterprise();
    	updateService.updaterCommited("V_0_1", "V_0_1", "setupHostEnterprise");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "projectStatus")) {
    	projectStatus();
    	updateService.updaterCommited("V_0_1", "V_0_1", "projectStatus");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "initUsers")) {
    	initUsers();
    	updateService.updaterCommited("V_0_1", "V_0_1", "initUsers");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "isIncludeInContractInit")) {
    	isIncludeInContractInit();
    	updateService.updaterCommited("V_0_1", "V_0_1", "isIncludeInContractInit");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "initFunctions1222")) {
    	initFunctions1222();
    	updateService.updaterCommited("V_0_1", "V_0_1", "initFunctions1222");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "initFunctions121")) {
    	initFunctions121();
    	updateService.updaterCommited("V_0_1", "V_0_1", "initFunctions121");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "orderId")) {
    	orderId();
    	updateService.updaterCommited("V_0_1", "V_0_1", "orderId");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "serviceBudgetContract")) {
    	serviceBudgetContract();
    	updateService.updaterCommited("V_0_1", "V_0_1", "serviceBudgetContract");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "projectSimplePy")) {
    	projectSimplePy();
    	updateService.updaterCommited("V_0_1", "V_0_1", "projectSimplePy");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "projectPassDate")) {
    	projectPassDate();
    	updateService.updaterCommited("V_0_1", "V_0_1", "projectPassDate");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "modifyCDBTitleFunction")) {
    	modifyCDBTitleFunction();
    	updateService.updaterCommited("V_0_1", "V_0_1", "modifyCDBTitleFunction");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "fixACTFunction")) {
    	fixACTFunction();
    	updateService.updaterCommited("V_0_1", "V_0_1", "fixACTFunction");
    }
    if (updateService.canPerformUpdate("V_0_1", "V_0_1", "updateProjectContractPriceStat")) {
    	updateProjectContractPriceStat();
    	updateService.updaterCommited("V_0_1", "V_0_1", "updateProjectContractPriceStat");
    }
    updateService.upgraderCommited("V_0_1", "V_0_2");
  }
}
